/*
 *create by Allen 前端拦截，带上token
 */
authConfig.$inject = [

    '$rootScope',
    '$transitions'
];

function authConfig($rootScope, $transitions) {

    $transitions.onStart({ to: 'manager.*' }, function(trans) {
        console.log("get in to ")
        var toState = trans.to();
        var $state = trans.router.stateService;
        if (!localStorage.getItem("username")) {
            console.log("failed ")
            $state.transitionTo('login');
        } else {
            console.log("success");
            return;
        }
    });

}

module.exports = authConfig;